package com.itheima.client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ClientMyRunable implements Runnable {
    private Socket socket;

    public ClientMyRunable(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        //循环重复的接收
        while (true) {
            try {
                //接收服务器发送过来的聊天记录
                BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                String mag = br.readLine();
                System.out.println(mag);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
